using OneDayModel.Interfaces;

namespace OneDayModel.Model
{
    public class ApplicationContext
    {
        private static readonly object lockObject = new object();
        private static ApplicationContext applicationContext;

        private IRepository repository;

        public IRepository Repository
        {
            get { return repository; }
            set { repository = value; }
        }

        public static ApplicationContext GetInstance()
        {
            if (applicationContext == null)
            {
                lock (lockObject)
                {
                    if (applicationContext == null)
                        applicationContext = new ApplicationContext();
                }
            }

            return applicationContext;
        }
    }
}